package com.maybach.workflow.core.expression;

import com.maybach.util.AssertUtil;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by houenxun on 15/9/29.
 * 表达式引擎工厂类
 */
public class ExpressionFactory {

    public void setExpressionMap(Map<String, IExpression> map) {
        ExpressionFactory.expressionMap = map;
    }

    private static Map<String, IExpression> expressionMap = new HashMap<String, IExpression>();


    public static IExpression getExpression(ScriptTypeEnum type) {
        AssertUtil.notNull(type, "type");
        return getExpression(type.name());
    }


    public static IExpression getExpression(String type) {
        AssertUtil.notBlank(type, "type");
        return expressionMap.get(type);
    }
}
